package nautilus.customwidget;

import nautilus.moneykeeper.R;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.LinearLayout;

public class LinearLayoutRightShadow extends LinearLayout{
	private Bitmap mShadowBitmap;
	private Rect mShadowRect = new Rect();
	private Paint _paint = new Paint();

	public LinearLayoutRightShadow(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public LinearLayoutRightShadow(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	@Override
	protected void dispatchDraw(Canvas canvas) {
		super.dispatchDraw(canvas);
		if (mShadowBitmap == null) {
			mShadowBitmap = BitmapFactory.decodeResource(getResources(),
					R.drawable.home_setting_swipe_menu_right_shadow);
		}
		android.util.Log.i("LinearLayoutRightShadow", "" + mShadowBitmap);
		mShadowRect.left = getMeasuredWidth() - (getMeasuredWidth() / 10);
		mShadowRect.top = 0;
		mShadowRect.right = getMeasuredWidth();
		mShadowRect.bottom = getMeasuredHeight();
		canvas.drawBitmap(mShadowBitmap, null, mShadowRect, _paint);
	}
}
